USE [TOM_MS]
GO

/****** Object:  Table [dbo].[AO_BOD]    Script Date: 12/21/2011 10:03:17 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AO_BOD](
	[BOD_ID] [int] IDENTITY(1,1) NOT NULL,
	[UNIT_ID] [int] NULL,
	[VALUE] [float] NULL,
	[CHOAN_LOG_ID] [int] NULL,
	[CREATED_DATE] [datetime] NULL,
 CONSTRAINT [PK_AO_BOD] PRIMARY KEY CLUSTERED 
(
	[BOD_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[AO_BOD]  WITH CHECK ADD  CONSTRAINT [FK_AO_BOD_CHOAN_LOG] FOREIGN KEY([CHOAN_LOG_ID])
REFERENCES [dbo].[CHOAN_LOG] ([CHOAN_ID])
GO

ALTER TABLE [dbo].[AO_BOD] CHECK CONSTRAINT [FK_AO_BOD_CHOAN_LOG]
GO

/****** Object:  Table [dbo].[AO_COD]    Script Date: 12/21/2011 10:03:42 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AO_COD](
	[COD_ID] [int] NULL,
	[UNIT_ID] [int] NULL,
	[VALUE] [float] NULL,
	[CHOAN_LOG_ID] [int] NULL,
	[CREATED_DATE] [datetime] NULL
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[AO_COD]  WITH CHECK ADD  CONSTRAINT [FK_AO_COD_CHOAN_LOG] FOREIGN KEY([CHOAN_LOG_ID])
REFERENCES [dbo].[CHOAN_LOG] ([CHOAN_ID])
GO

ALTER TABLE [dbo].[AO_COD] CHECK CONSTRAINT [FK_AO_COD_CHOAN_LOG]
GO

/****** Object:  Table [dbo].[AO_DO]    Script Date: 12/21/2011 10:03:50 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AO_DO](
	[DO_ID] [int] IDENTITY(1,1) NOT NULL,
	[UNIT_ID] [int] NULL,
	[CHOAN_LOG_ID] [int] NULL,
	[VALUE] [float] NULL,
	[CREATED_DATE] [datetime] NULL,
 CONSTRAINT [PK_AO_DO_1] PRIMARY KEY CLUSTERED 
(
	[DO_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[AO_DO]  WITH CHECK ADD  CONSTRAINT [FK_AO_DO_CHOAN_LOG1] FOREIGN KEY([CHOAN_LOG_ID])
REFERENCES [dbo].[CHOAN_LOG] ([CHOAN_ID])
GO

ALTER TABLE [dbo].[AO_DO] CHECK CONSTRAINT [FK_AO_DO_CHOAN_LOG1]
GO


/****** Object:  Table [dbo].[AO_DO_TRONG]    Script Date: 12/21/2011 10:04:13 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AO_DO_TRONG](
	[DO_TRONG_ID] [int] IDENTITY(1,1) NOT NULL,
	[CHOAN_LOG_ID] [int] NULL,
	[UNIT_ID] [int] NULL,
	[VALUE] [float] NULL,
	[CREATED_DATE] [datetime] NULL,
 CONSTRAINT [PK_AO_DO_TRONG] PRIMARY KEY CLUSTERED 
(
	[DO_TRONG_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[AO_DO_TRONG]  WITH CHECK ADD  CONSTRAINT [FK_AO_DO_TRONG_CHOAN_LOG] FOREIGN KEY([CHOAN_LOG_ID])
REFERENCES [dbo].[CHOAN_LOG] ([CHOAN_ID])
GO

ALTER TABLE [dbo].[AO_DO_TRONG] CHECK CONSTRAINT [FK_AO_DO_TRONG_CHOAN_LOG]
GO


/****** Object:  Table [dbo].[AO_DOKIEM]    Script Date: 12/21/2011 10:04:21 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AO_DOKIEM](
	[DO_KIEM_ID] [int] IDENTITY(1,1) NOT NULL,
	[UNIT_ID] [int] NULL,
	[VALUE] [float] NULL,
	[CHOAN_LOG] [int] NULL,
 CONSTRAINT [PK_AO_DOKIEM] PRIMARY KEY CLUSTERED 
(
	[DO_KIEM_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[AO_DOKIEM]  WITH CHECK ADD  CONSTRAINT [FK_AO_DOKIEM_CHOAN_LOG] FOREIGN KEY([CHOAN_LOG])
REFERENCES [dbo].[CHOAN_LOG] ([CHOAN_ID])
GO

ALTER TABLE [dbo].[AO_DOKIEM] CHECK CONSTRAINT [FK_AO_DOKIEM_CHOAN_LOG]
GO

/****** Object:  Table [dbo].[AO_DOMAN]    Script Date: 12/21/2011 10:04:37 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AO_DOMAN](
	[DOMAN_ID] [int] IDENTITY(1,1) NOT NULL,
	[VALUE] [float] NULL,
	[CHOAN_LOG_ID] [int] NOT NULL,
	[CREATED_DATE] [datetime] NULL,
 CONSTRAINT [PK_AO_DOMAN] PRIMARY KEY CLUSTERED 
(
	[DOMAN_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[AO_DOMAN]  WITH CHECK ADD  CONSTRAINT [FK_AO_DOMAN_CHOAN_LOG] FOREIGN KEY([CHOAN_LOG_ID])
REFERENCES [dbo].[CHOAN_LOG] ([CHOAN_ID])
GO

ALTER TABLE [dbo].[AO_DOMAN] CHECK CONSTRAINT [FK_AO_DOMAN_CHOAN_LOG]
GO

/****** Object:  Table [dbo].[CHOAN_LOG]    Script Date: 12/21/2011 10:04:50 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[CHOAN_LOG](
	[CHOAN_ID] [int] IDENTITY(1,1) NOT NULL,
	[TOM_ID] [int] NULL,
	[AGE] [int] NULL,
	[CU_AN_ID] [int] NULL,
	[FOOD_CODE] [nvarchar](50) NULL,
	[NOTE] [nvarchar](500) NULL,
	[SEASON_ID] [int] NULL,
	[AO_ID] [int] NULL,
	[CREATED_BY] [nvarchar](50) NULL,
 CONSTRAINT [PK_CHOAN_LOG] PRIMARY KEY CLUSTERED 
(
	[CHOAN_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[CHOAN_LOG]  WITH CHECK ADD  CONSTRAINT [FK_CHOAN_LOG_AO] FOREIGN KEY([AO_ID])
REFERENCES [dbo].[AO] ([AO_ID])
GO

ALTER TABLE [dbo].[CHOAN_LOG] CHECK CONSTRAINT [FK_CHOAN_LOG_AO]
GO

ALTER TABLE [dbo].[CHOAN_LOG]  WITH CHECK ADD  CONSTRAINT [FK_CHOAN_LOG_CU_AN] FOREIGN KEY([CU_AN_ID])
REFERENCES [dbo].[CU_AN] ([CU_AN_ID])
GO

ALTER TABLE [dbo].[CHOAN_LOG] CHECK CONSTRAINT [FK_CHOAN_LOG_CU_AN]
GO

ALTER TABLE [dbo].[CHOAN_LOG]  WITH CHECK ADD  CONSTRAINT [FK_CHOAN_LOG_SEASON] FOREIGN KEY([SEASON_ID])
REFERENCES [dbo].[SEASON] ([SEASON_ID])
GO

ALTER TABLE [dbo].[CHOAN_LOG] CHECK CONSTRAINT [FK_CHOAN_LOG_SEASON]
GO


/****** Object:  Table [dbo].[AO_NH]    Script Date: 12/21/2011 10:05:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AO_NH](
	[NH_ID] [int] IDENTITY(1,1) NOT NULL,
	[UNIT_ID] [int] NULL,
	[CHOAN_LOG_ID] [int] NULL,
	[CREATED_DATE] [datetime] NULL,
	[VALUE] [float] NULL,
 CONSTRAINT [PK_AO_NH] PRIMARY KEY CLUSTERED 
(
	[NH_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[AO_NH]  WITH CHECK ADD  CONSTRAINT [FK_AO_NH_CHOAN_LOG] FOREIGN KEY([CHOAN_LOG_ID])
REFERENCES [dbo].[CHOAN_LOG] ([CHOAN_ID])
GO

ALTER TABLE [dbo].[AO_NH] CHECK CONSTRAINT [FK_AO_NH_CHOAN_LOG]
GO

/****** Object:  Table [dbo].[AO_PH]    Script Date: 12/21/2011 10:05:25 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AO_PH](
	[PH_ID] [int] IDENTITY(1,1) NOT NULL,
	[CHOAN_ID] [int] NOT NULL,
	[PH_SANG] [float] NULL,
	[PH_CHIEU] [float] NULL,
 CONSTRAINT [PK_AO_PH] PRIMARY KEY CLUSTERED 
(
	[PH_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[AO_PH]  WITH CHECK ADD  CONSTRAINT [FK_AO_PH_CHOAN_LOG] FOREIGN KEY([CHOAN_ID])
REFERENCES [dbo].[CHOAN_LOG] ([CHOAN_ID])
GO

ALTER TABLE [dbo].[AO_PH] CHECK CONSTRAINT [FK_AO_PH_CHOAN_LOG]
GO


/****** Object:  Table [dbo].[AO_TOM_SIZE]    Script Date: 12/21/2011 10:05:39 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AO_TOM_SIZE](
	[TOM_SIZE_ID] [int] IDENTITY(1,1) NOT NULL,
	[CHOAN_ID] [int] NULL,
	[VALUE] [int] NULL,
	[UNIT_ID] [int] NULL,
	[CREATED_DATE] [datetime] NULL,
 CONSTRAINT [PK_AO_TOM_SIZE] PRIMARY KEY CLUSTERED 
(
	[TOM_SIZE_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[AO_TOM_SIZE]  WITH CHECK ADD  CONSTRAINT [FK_AO_TOM_SIZE_CHOAN_LOG] FOREIGN KEY([CHOAN_ID])
REFERENCES [dbo].[CHOAN_LOG] ([CHOAN_ID])
GO

ALTER TABLE [dbo].[AO_TOM_SIZE] CHECK CONSTRAINT [FK_AO_TOM_SIZE_CHOAN_LOG]
GO


/****** Object:  Table [dbo].[AO_TOM_STATUS]    Script Date: 12/21/2011 10:05:49 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AO_TOM_STATUS](
	[TOM_STATUS_ID] [int] IDENTITY(1,1) NOT NULL,
	[VALUE] [int] NULL,
	[UNIT_ID] [int] NULL,
	[CREATED_DATE] [datetime] NULL,
	[CHOAN_LOG_ID] [int] NULL,
	[TOM_STATUS_NAME] [nvarchar](50) NULL,
 CONSTRAINT [PK_AO_TOM_STATUS] PRIMARY KEY CLUSTERED 
(
	[TOM_STATUS_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[AO_TOM_STATUS]  WITH CHECK ADD  CONSTRAINT [FK_AO_TOM_STATUS_CHOAN_LOG] FOREIGN KEY([CHOAN_LOG_ID])
REFERENCES [dbo].[CHOAN_LOG] ([CHOAN_ID])
GO

ALTER TABLE [dbo].[AO_TOM_STATUS] CHECK CONSTRAINT [FK_AO_TOM_STATUS_CHOAN_LOG]
GO


/****** Object:  Table [dbo].[CU_AN_HIS]    Script Date: 12/21/2011 10:05:59 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[CU_AN_HIS](
	[CUAN_HIS_ID] [int] NOT NULL,
	[CHOAN_ID] [int] NOT NULL,
	[CUAN_ID] [int] NOT NULL,
	[STATUS_ID] [int] NOT NULL,
	[ACTUAL_AMOUNT] [int] NOT NULL,
 CONSTRAINT [PK_CU_AN_HIS] PRIMARY KEY CLUSTERED 
(
	[CUAN_HIS_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[CU_AN_HIS]  WITH CHECK ADD  CONSTRAINT [FK_CU_AN_HIS_CHOAN_LOG] FOREIGN KEY([CHOAN_ID])
REFERENCES [dbo].[CHOAN_LOG] ([CHOAN_ID])
GO

ALTER TABLE [dbo].[CU_AN_HIS] CHECK CONSTRAINT [FK_CU_AN_HIS_CHOAN_LOG]
GO


/****** Object:  Table [dbo].[HIENTUONG]    Script Date: 12/21/2011 10:06:09 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[HIENTUONG](
	[HIENTUONG_ID] [int] IDENTITY(1,1) NOT NULL,
	[CHOAN_LOG] [int] NOT NULL,
	[HIENTUONG_NAME] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_HIENTUONG] PRIMARY KEY CLUSTERED 
(
	[HIENTUONG_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[HIENTUONG]  WITH CHECK ADD  CONSTRAINT [FK_HIENTUONG_CHOAN_LOG] FOREIGN KEY([CHOAN_LOG])
REFERENCES [dbo].[CHOAN_LOG] ([CHOAN_ID])
GO

ALTER TABLE [dbo].[HIENTUONG] CHECK CONSTRAINT [FK_HIENTUONG_CHOAN_LOG]
GO

/****** Object:  Table [dbo].[CALENDAR]    Script Date: 12/21/2011 10:06:39 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[CALENDAR](
	[CALENDAR_ID] [int] IDENTITY(1,1) NOT NULL,
	[DOVO_TIME] [int] NULL,
	[PH_TIME] [int] NULL,
	[KYTHUAT_TIME] [int] NULL,
	[KIEMSOAT_TIME] [int] NULL,
	[CU_AN_NAME] [nvarchar](50) NULL,
 CONSTRAINT [PK_CALENDAR] PRIMARY KEY CLUSTERED 
(
	[CALENDAR_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

